//
//  EPMBaseNavController.m
//  WeiBoByOC
//
//  Created by 马继鵬 on 17/3/19.
//  Copyright © 2017年 7TH. All rights reserved.
//

#import "EPMBaseNavController.h"

@interface EPMBaseNavController ()<UIGestureRecognizerDelegate>

@end

@implementation EPMBaseNavController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.interactivePopGestureRecognizer.delegate = self;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    NSUInteger count = self.viewControllers.count;
    
    if (count >0)
    {
        viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem EPM_Title:@"返回" imageName:@"navigationbar_back_withtext" target:self action:@selector(back:)];
        viewController.view.backgroundColor = [UIColor whiteColor];
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:YES];
}

#pragma
#pragma-点击事件
- (void)back:(id)sender
{
    [self popViewControllerAnimated:YES];
}

#pragma
#pragma-手势代理
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
    NSUInteger count = self.viewControllers.count;
    return (count > 1);
}

@end
